#!/bin/bash
set -e

function info() {
echo Usage: `basename $0` 'sample_summary sample_interval_summary'
exit 65
}

while getopts  ":u:h" opts
do
        case  $opts  in
		u) user=$OPTARG;;
		h) info;;
		esac
done
shift $(($OPTIND - 1))

if [ -z "$1" ]; then info; fi


. /mnt/ilustre/app/medical/tools/.var

col7=7
col9=9

sample_name=`tail -n +2 $1 |head -n1 |cut -d',' -f1`
tail -n +2 $1 |head -n1 |cut -d',' -f$col7 >perct.txt
tail -n +2 $2 |cut -d',' -f$col9 >>perct.txt

Rscript ${tools_path}/script/cov_plot.r perct.txt

# rm perct.txt

. $cmd_done